.TH "LevelThree" 3 "4 Dec 2009" "Earth: 20000" \" -*- nroff -*-
.ad l
.nh
.SH NAME
LevelThree \- 
.SH SYNOPSIS
.br
.PP
.PP
\fC#include <levelThree.h>\fP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBLevelThree\fP (QGraphicsScene *theScene)"
.br
.in -1c
.SS "Private Member Functions"

.in +1c
.ti -1c
.RI "QRectF \fBboundingRect\fP () const "
.br
.ti -1c
.RI "void \fBpaint\fP (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)"
.br
.ti -1c
.RI "int \fBgenerateRandomNumber\fP (int min, int max)"
.br
.in -1c
.SS "Private Attributes"

.in +1c
.ti -1c
.RI "int \fBxPos\fP"
.br
.ti -1c
.RI "int \fByPos\fP"
.br
.ti -1c
.RI "\fBBlock\fP * \fBblock\fP [11][20]"
.br
.in -1c
.SH "Detailed Description"
.PP 
\fBlevelThree.cpp\fP
.PP
Creates the design for the second level. Uses the polymorphism feature of the \fBblock.cpp\fP class and randomly generates blocks of different colors and places them in a pre-defined layout.
.PP
Author: Natraj Subramanian 
.PP
Definition at line 17 of file levelThree.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "LevelThree::LevelThree (QGraphicsScene * theScene)"
.PP
Definition at line 4 of file levelThree.cpp.
.PP
.nf
5 {
6     xPos = -380 + (BOUNDWIDTH - 20 * OUTLINEW)/2;
7     yPos = -630 + (BOUNDHEIGHT)/(8);
8 
9     // Declare variable to hold seconds in clock
10     time_t seconds;
11 
12     // Get value from system clock and place in seconds variable
13     time(&seconds);
14 
15     // Convert seconds to a unsigned integer
16     srand((unsigned int) seconds);
17 
18     int detColor;
19 
20     for(int i = 0; i < 11; i++)
21     {
22         for(int j = 0; j < 20; j++)
23         {
24             if(((i == 0 || i == 1 || i == 2 || i == 3 || i == 5 || i == 5 || i == 7
25                  || i == 9) && (j == 0 || ( j > 6 && j < 13 ) || j == 19) ) ||
26                  (i == 3 || i == 4) && (j == 0 || j == 19))
27             {
28                 xPos += BLOCKW + SPACE;
29             }
30             else
31             {
32                 detColor = generateRandomNumber(0,5);
33 
34                 if(detColor == 0)
35                 {
36                     block[i][j] = new MonoBlock;
37                 }
38                 if(detColor == 1)
39                 {
40                     block[i][j] = new RedBlock;
41                 }
42                 if(detColor == 2)
43                 {
44                     block[i][j] = new GreenBlock;
45                 }
46                 if(detColor == 3)
47                 {
48                     block[i][j] = new BlueBlock;
49                 }
50                 if(detColor == 4)
51                 {
52                     block[i][j] = new MagentaBlock;
53                 }
54                 if(detColor == 5)
55                 {
56                     block[i][j] = new YellowBlock;
57                 }
58 
59                 // setXPos and setYPos are used to assist the ball with its block
60                 // collision detection
61                 block[i][j]->setXPos(xPos);
62                 block[i][j]->setYPos(yPos);
63                 block[i][j]->scale(1.0, 1.0);
64                 block[i][j]->setPos(xPos, yPos);
65                 xPos += BLOCKW + SPACE;
66                 theScene->addItem(block[i][j]);
67             }
68         }
69 
70         yPos += BLOCKH + SPACE;
71         xPos = -380 + (BOUNDWIDTH - 20 * OUTLINEW)/2;
72     }
73 }
.fi
.SH "Member Function Documentation"
.PP 
.SS "QRectF LevelThree::boundingRect () const\fC [private]\fP"
.PP
Definition at line 75 of file levelThree.cpp.
.PP
.nf
76 {
77     return QRectF(375, 625, BOUNDWIDTH, BOUNDHEIGHT);
78 }
.fi
.SS "int LevelThree::generateRandomNumber (int min, int max)\fC [private]\fP"Given a min and a max, generate a random number between this range 
.PP
Definition at line 91 of file levelThree.cpp.
.PP
.nf
92 {
93     return rand() % (max - min + 1) + min;
94 }
.fi
.SS "void LevelThree::paint (QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = \fC0\fP)\fC [private]\fP"
.PP
Definition at line 80 of file levelThree.cpp.
.PP
.nf
81 {
82     Q_UNUSED(painter);
83     Q_UNUSED(option);
84     Q_UNUSED(widget);
85 }
.fi
.SH "Member Data Documentation"
.PP 
.SS "\fBBlock\fP* \fBLevelThree::block\fP[11][20]\fC [private]\fP"
.PP
Definition at line 21 of file levelThree.h.
.SS "int \fBLevelThree::xPos\fP\fC [private]\fP"
.PP
Definition at line 20 of file levelThree.h.
.SS "int \fBLevelThree::yPos\fP\fC [private]\fP"
.PP
Definition at line 20 of file levelThree.h.

.SH "Author"
.PP 
Generated automatically by Doxygen for Earth: 20000 from the source code.
